package com.lancoo.znbkxx.teacher.adapter;


import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;


import com.example.library.FlowAdapter;
import com.lancoo.znbkxx.teacher.R;
import com.lancoo.znbkxx.teacher.model.TextInfo;

import java.util.List;

/**
 * @author : Admin
 * @date : 2019/8/14 22:00
 * @desc :
 */
public class TextFlowAdapter extends FlowAdapter<TextInfo> {
    private List<TextInfo> list;
    private LayoutInflater mLayoutInflater;

    public TextFlowAdapter(List<TextInfo> list, LayoutInflater mLayoutInflater) {
        super(list);
        this.list = list;
        this.mLayoutInflater = mLayoutInflater;
    }

    @Override
    public View getView(int position) {
        TextInfo textInfo = list.get(position);
        View view = mLayoutInflater.inflate(R.layout.item_textinfo, null, false);
        TextView tvType = view.findViewById(R.id.tv_type);
        int type = list.get(position).getType();
        TextView tv = view.findViewById(R.id.tv_text);
        tv.setText(textInfo.getText());
//        View line = view.findViewById(R.id.v_line);
//        if (type == 0) {
//            line.setVisibility(View.VISIBLE);
//        } else if (type == 1) {
//            tvType.setGravity(Gravity.CENTER);
//            tvType.setText("/");
//        } else if (type == 2) {
//            tvType.setGravity(Gravity.LEFT);
//            tvType.setText("\\");
//        } else if (type == 3) {
//            tvType.setGravity(Gravity.RIGHT);
//            tvType.setText("/");
//        }
        return view;
    }
}
